function forgetPwd() {
    layer.alert("账户密码遗失请联系在线客服！");
}
function doLogin() {
    var un = $("#username").val();
    if (un == "") {
        layer.alert("登录账号不能为空！");
        $("#username").focus();
        return false;
    }
    var pw = $("#password").val();
    if (pw == "" || pw == "xx@x@x.x") {
        layer.alert("登录密码不能为空！");
        $("#password").focus();
        return false;
    }

    var url = "/index.php/login/agent_dologin";

    $.post(url, {name: un, pwd: pw}, function (data) {
        if (data.result <= 0) {
            layer.alert(data.message);
            $("#password").val('');
            $("#username").select();
            return false;
        } else {
            window.location.href = '/index.php/agent/index';
        }
    }, "json");
	
  //  window.location.href = '/';
}

 document.onkeydown = function (event) {
    var e = event || window.event || arguments.callee.caller.arguments[0];
    if (e && e.keyCode == 13) { 
        doLogin();
    }
}; 
